import QtQuick
import QtQuick.Controls
import QtQuick.Controls.Basic
import QtQuick.Layouts

// TextField - Base
Rectangle {
    Layout.fillWidth: true
    Layout.fillHeight: true

    Column {
        spacing: 20
        anchors.centerIn: parent
        width: parent.width * 0.8

        TextField {
            id: basicTextField
            width: parent.width
            height: 30
            placeholderText: "请输入用户名..."

            // 背景框
            background: Rectangle {
                border.color: "#c0c0c0"
                border.width: 1
                radius: 4
            }

            onTextChanged: {
                console.log("当前输入:", text)
            }

            onAccepted: {
                console.log("用户按下回车键")
            }
        }

        Text {
            text: "输入内容: " + basicTextField.text
            width: parent.width
            elide: Text.ElideRight
        }
    }
}
